package main

import (
	"fmt"
	"time"
)

func main() {
	count := 10
	done := make(chan int)
	for i := 0; i < count; i++ {
		go worker(i, done)
		<-done

	}
	// time.Sleep(time.Second)
	// exit:
	// 	for {
	// 		select {
	// 		case v := <-done:
	// 			fmt.Println("worker ", v)
	// 			continue
	// 		default:
	// 			fmt.Println("exit")
	// 			break exit
	// 		}
	// 	}

}

func worker(i int, done chan int) {
	time.Sleep(time.Millisecond * 10)
	fmt.Printf("worker %d done\n", i)
	done <- i
}
